package com.geek.javase.wcy03.relation.Game;

import java.util.concurrent.TimeUnit;

/**
 * @author wangchaoyang
 * @desc TODO
 * @date 2025/9/3
 */
public class Test {

    public static void main(String[] args) {
        //多态：父类的引用指向子类的实例
        Role hero = new Hero("剑圣" , 8 , 1600 ,"人类" , 200 , 60);
        Monster monster = new Monster("哥斯拉" , 9 , 2000 , "兽类" , 280 , 220);

        Equip equip1 = new Equip("倚天剑" , 6 , "金色" , "剑类" , 110 , 0);
        Equip equip2 = new Equip("屠龙刀" , 7 , "银色" , "刀类" , 100 , 20);
        Equip equip3 = new Equip("仁王盾" , 6 , "白色" , "盾类" , 0 , 100);
        Equip equip4 = new Equip("短刀" , 3 , "橙色" , "小刀" , 20 , 0);
        ((Hero)hero).addEquip(equip1);
//        hero.addEquip(equip2);
//        hero.addEquip(equip3);
        //hero.addEquip(equip4);

        /*hero.show();
        System.out.println("----------------");
        monster.show();*/

        //回合制攻击
        int count = 0;
        while (true){
            System.out.println("----------- 第"+(++count)+"轮攻击------------");

            hero.attack(monster);
            if (monster.isDead()) {
                System.out.println("怪兽死亡 ， Game  Over");
                System.exit(0);
            }
            //沉睡
            try {
                TimeUnit.SECONDS.sleep(1);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }

            monster.attack(hero);
            if(hero.isDead()){
                System.out.println("英雄死亡 ， Game  Over");
                System.exit(0);
            }
            //沉睡
            try {
                TimeUnit.SECONDS.sleep(1);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }

}